package com.baiduspring.dao.mapper;

import com.baiduspring.dao.entity.User;
import com.baiduspring.dao.mapper.params.UserParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

@Component
@Mapper
public interface UserMapper {
    int deleteByPrimaryKey(Long id);

    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    Integer uniqueness(User record);

    User selectByNameAndPassword(UserParam param);
//    User selectByNameAndPassword(@Param("name") String name, @Param("password") String password);

    User selectByName(UserParam param);
//    User selectByName(@Param("name") String name);

    User selectByAccount(@Param("account") Long account);

    int updateHomepageViewsByAccount(@Param("account") Long account);

    /**
     * 根据手机号码修改密码
     *
     * @param mobile      手机号码
     * @param newPassword 新密码
     */
    int updatePasswordByMobile(@Param("mobile") String mobile, @Param("newPassword") String newPassword);
}